upstream_llvm21
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Sat, 24 Jan 2026 07:42:10 +0000 (07:42 +0000)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 24 Jan 2026 07:42:10 +0000 (07:42 +0000)
Gbp-Pq: Name upstream_llvm21.diff

.cmake.conf
src/linguist/lupdate/clangtoolastreader.cpp
src/linguist/lupdate/cpp_clang.h
src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h

index ce79f79eaebff5d623d8b0b759f80198c2d20069..d0cc09e1eac026f5bc3837a37f498ba7588571bb 100644 (file)
@@ -3,7 +3,7 @@ set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
 set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
 set(QDOC_MINIMUM_CLANG_VERSION "17")
 set(QDOC_SUPPORTED_CLANG_VERSIONS
-    "20.1" "19.1" "18.1" "17.0"
+    "21.1" "20.1" "19.1" "18.1" "17.0"
 )
 list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")
 list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
index 3db9e0d64a7c1b5e927821571a3b971a4863da61..eeab4381b111fb4c543d0257d02689cef53c6fda 100644 (file)
@@ -734,9 +734,25 @@ void LupdateVisitor::processPreprocessorCalls()
                 || fileNameRealPath.str() == m_inputFile)
             continue;
 
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0))
+        auto sourceFile = sourceMgr.getFileManager()
+            .getFileRef(fileNameRealPath);
+        if (!sourceFile)
+            continue;
+        auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1);
+#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
+        auto sourceFile = sourceMgr.getFileManager()
+            .getOptionalFileRef(fileNameRealPath);
+        if (!sourceFile)
+            continue;
+        auto sourceLocation = sourceMgr.translateFileLineCol(&sourceFile->getFileEntry(), 1, 1);
+#else
         auto sourceFile = sourceMgr.getFileManager()
             .getFile(fileNameRealPath);
+        if (!sourceFile)
+            continue;
         auto sourceLocation = sourceMgr.translateFileLineCol(sourceFile.get(), 1, 1);
+#endif
         const clang::FileID fileId = sourceMgr.getDecomposedLoc(sourceLocation).first;
         processIsolatedComments(fileId);
     }
index 12c66114c3d20a351751f5bea918edad47ce866b..43a1c7871b18d3a9a4b31a1e779a22205ed35d9e 100644 (file)
@@ -150,14 +150,30 @@ struct TranslationRelatedStore
     clang::SourceLocation callLocation(const clang::SourceManager &sourceManager)
     {
         if (sourceLocation.isInvalid()) {
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(21,0,0))
+            auto sourceFile = sourceManager.getFileManager()
+                .getFileRef(lupdateLocationFile.toStdString());
+            if (sourceFile)
+                sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(),
+                    lupdateLocationLine, locationCol);
+#elif (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(16,0,0))
+            auto sourceFile = sourceManager.getFileManager()
+                .getOptionalFileRef(lupdateLocationFile.toStdString());
+            if (sourceFile)
+                sourceLocation = sourceManager.translateFileLineCol(&sourceFile->getFileEntry(),
+                    lupdateLocationLine, locationCol);
+#else
             auto sourceFile = sourceManager.getFileManager()
                 .getFile(lupdateLocationFile.toStdString());
 #if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(10,0,0))
-            sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(),
-                lupdateLocationLine, locationCol);
+            if (sourceFile)
+                sourceLocation = sourceManager.translateFileLineCol(sourceFile.get(),
+                    lupdateLocationLine, locationCol);
 #else
-            sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine,
-                locationCol);
+            if (sourceFile)
+                sourceLocation = sourceManager.translateFileLineCol(sourceFile, lupdateLocationLine,
+                    locationCol);
+#endif
 #endif
         }
         return sourceLocation;
index 29a9250dea48e46c44d79dd0cb78164bdc3783b6..9778599111ddebf85293cc3de2ed2a317c05fc76 100644 (file)
@@ -25,6 +25,7 @@ QT_WARNING_DISABLE_MSVC(4267)
 #include "clang/AST/DeclarationName.h"
 #include "clang/AST/GlobalDecl.h"
 #include "clang/AST/Mangle.h"
+#include "clang/Basic/Version.h"
 
 QT_WARNING_POP
 
@@ -160,9 +161,15 @@ static inline const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx,
     // If a fully qualified arg is different from the unqualified arg,
     // allocate new type in the AST.
     if (MightHaveChanged) {
+#if CLANG_VERSION_MAJOR >= 21
+      QualType QT = Ctx.getTemplateSpecializationType(
+          TST->getTemplateName(), FQArgs, /*CanonicalArgs=*/{},
+          TST->getCanonicalTypeInternal());
+#else
       QualType QT = Ctx.getTemplateSpecializationType(
           TST->getTemplateName(), FQArgs,
           TST->getCanonicalTypeInternal());
+#endif
       // getTemplateSpecializationType returns a fully qualified
       // version of the specialization itself, so no need to qualify
       // it.
@@ -192,9 +199,15 @@ static inline const Type *getFullyQualifiedTemplateType(const ASTContext &Ctx,
       // allocate new type in the AST.
       if (MightHaveChanged) {
         TemplateName TN(TSTDecl->getSpecializedTemplate());
+#if CLANG_VERSION_MAJOR >= 21
+        QualType QT = Ctx.getTemplateSpecializationType(
+            TN, FQArgs, /*CanonicalArgs=*/{},
+            TSTRecord->getCanonicalTypeInternal());
+#else
         QualType QT = Ctx.getTemplateSpecializationType(
             TN, FQArgs,
             TSTRecord->getCanonicalTypeInternal());
+#endif
         // getTemplateSpecializationType returns a fully qualified
         // version of the specialization itself, so no need to qualify
         // it.
@@ -257,7 +270,10 @@ static inline NestedNameSpecifier *getFullyQualifiedNestedNameSpecifier(
           Ctx, Scope->getPrefix(), WithGlobalNsPrefix);
     case NestedNameSpecifier::Super:
     case NestedNameSpecifier::TypeSpec:
-    case NestedNameSpecifier::TypeSpecWithTemplate: {
+#if CLANG_VERSION_MAJOR < 21
+    case NestedNameSpecifier::TypeSpecWithTemplate:
+#endif
+    {
       const Type *Type = Scope->getAsType();
       // Find decl context.
       const TagDecl *TD = nullptr;
@@ -369,7 +385,10 @@ inline NestedNameSpecifier *createNestedNameSpecifier(const ASTContext &Ctx,
 
   return NestedNameSpecifier::Create(
       Ctx, createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix),
-      false /*No TemplateKeyword*/, TypePtr);
+#if CLANG_VERSION_MAJOR < 21
+      false /*No TemplateKeyword*/,
+#endif
+      TypePtr);
 }
 
 /// Return the fully qualified type, including fully-qualified
@@ -393,9 +412,13 @@ inline QualType getFullyQualifiedType(QualType QT, const ASTContext &Ctx,
     Qualifiers Quals = QT.getQualifiers();
     // Fully qualify the pointee and class types.
     QT = getFullyQualifiedType(QT->getPointeeType(), Ctx, WithGlobalNsPrefix);
+#if CLANG_VERSION_MAJOR >= 21
+    QT = Ctx.getMemberPointerType(QT, MPT->getQualifier(), MPT->getMostRecentCXXRecordDecl());
+#else
     QualType Class = getFullyQualifiedType(QualType(MPT->getClass(), 0), Ctx,
                                            WithGlobalNsPrefix);
     QT = Ctx.getMemberPointerType(QT, Class.getTypePtr());
+#endif
     // Add back the qualifiers.
     QT = Ctx.getQualifiedType(QT, Quals);
     return QT;